import React, {Component} from 'react';
import {StoreProvider} from 'iflux2';
import AppStore from './store';

import OrderStep from './component/order-step';
import OrderInfo from './component/order-info';
import OrderItems from './component/order-items';
import OrderLogs from './component/order-logs';

import { Spin } from 'antd';

@StoreProvider(AppStore)
export default class OrderDetail extends Component {
    constructor(props) {
        super(props);

        this.state = {
            loading: true
        }
    }

    componentDidMount() {
        this.props.store.queryDetail(this.props.params.tid).then(()=>{
            this.setState({loading: false});
        }).catch(()=>{
            this.setState({loading: false})
        });

        this.props.store.queryShipCompanys();
    }


    render() {
        return (
            <Spin spinning={this.state.loading}>
                <div className="order-detail">
                    <div className="order-bd-top"></div>
                    <OrderStep/>
                    <OrderInfo/>
                    <OrderItems/>
                    <OrderLogs/>
                </div>
            </Spin>
        )
    }
}